
export const loginRouter = {
  path: '/login',
  name: 'login',
  meta: {
    title: 'Login - 登录',
    isAnonymous: true
  },
  component: resolve => require([`@/views/login`], resolve),
};

export const homePage = {
  path: '/',
  component: resolve => require([`@/components/main`], resolve),
  redirect: '/home',
  children: [
    {
      path: 'home',
      name: 'home',
      component: resolve => require([`@/views/home/index`], resolve),
      meta: {
        title: '主页'
      }
    },
    {
      path: 'profile',
      name: 'profile',
      component: resolve => require(['@/views/profile/index.vue'], resolve),
      meta: {
        title: '个人中心'
      }
    },
    {
      path: 'patient',
      name: '患者',
      component: resolve => require([`@/views/fhir/patient/index`], resolve),
      meta: {
        title: '患者'
      }
    },
    {
      path: 'appointment',
      name: '预约',
      component: resolve => require([`@/views/fhir/appointment/index`], resolve),
      meta: {
        title: '预约'
      }
    },
    {
      path: 'enc',
      name: '就诊',
      component: resolve => require([`@/views/fhir/enc/index`], resolve),
      meta: {
        title: '就诊'
      }
    },
    {
      path: 'medication',
      name: '医嘱',
      component: resolve => require([`@/views/fhir/medication/index`], resolve),
      meta: {
        title: '医嘱'
      }
    },
    {
      path: 'codeSystem',
      name: '术语',
      component: resolve => require([`@/views/fhir/code-system/index`], resolve),
      meta: {
        title: '术语'
      }
    },
    {
      path: 'procedure',
      name: '手术',
      component: resolve => require([`@/views/fhir/procedure/index`], resolve),
      meta: {
        title: '手术'
      }
    },
    {
      path: 'code-system',
      name: '术语',
      component: resolve => require([`@/views/fhir/code-system/index`], resolve),
      meta: {
        title: '术语'
      }
    },
    {
      path: 'request',
      name: '检查申请',
      component: resolve => require([`@/views/fhir/request/index`], resolve),
      meta: {
        title: '检查申请'
      }
    },
    {
      path: 'preport',
      name: '检查报告',
      component: resolve => require([`@/views/fhir/preport/index`], resolve),
      meta: {
        title: '检查报告'
      }
    },
    {
      path: 'labreport',
      name: '检验报告',
      component: resolve => require([`@/views/fhir/labreport/index`], resolve),
      meta: {
        title: '检验报告'
      }
    },
    {
      path: 'bundle',
      name: 'FHIR文档',
      component: resolve => require([`@/views/fhir/bundle/index`], resolve),
      meta: {
        title: 'FHIR文档'
      }
    },
  ]
};

export const pageError = [
  {
    path: '/404',
    name: 'error-404',
    meta: {
      title: '404-页面不存在',
      isAnonymous: true
    },
    component: resolve => require(['@/views/error-page/404.vue'], resolve)
  },
  {
    path: '/403',
    name: 'error-403',
    component: resolve => require(['@/views/error-page/403.vue'], resolve),
    meta: {
      title: '403-权限不足',
      isAnonymous: true
    }
  },
  {
    path: '/500',
    name: 'error-500',
    component: resolve => require(['@/views/error-page/500.vue'], resolve),
    meta: {
      title: '500-服务端错误',
      isAnonymous: true
    }
  }
]

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
  loginRouter,
  homePage,
  ...pageError
];
